# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=openvas-smb
pkgver=1.0.5
pkgrel=3
pkgdesc="SMB module for OpenVAS Scanner"
url="https://github.com/greenbone/openvas-smb"
arch="x86 x86_64"
license="GPL-2.0"
options="!check" #no check available
makedepends="cmake mingw-w64-gcc mingw-w64-binutils mingw-w64-headers mingw-w64-crt
gvm-libs-dev gnutls-dev popt-dev perl-dev
glib-dev xmltoman doxygen graphviz heimdal-dev sqlite-dev"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/greenbone/openvas-smb/archive/v$pkgver.tar.gz
	mingw-alpine-support.patch
	fix-missing-includes-path.patch
	comparison_fn_t.patch
	disable-backtrace.patch
	001-cmakelist-fortify.patch"

build() {
	cmake \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=ON .
	# generate winexesvc_exe.c early to work around parallel build issue
	make -C winexe bin2c
	make -j1 -C winexe winexesvc_exe.c.o
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="8b63fd269c96f67621ca900b748c523802fef6bb19f25d10b2bcaf839570b65164b79524e969971e2f278576f5e85326825a9e3a2331b0e5b165254cc947d2c2  openvas-smb-1.0.5.tar.gz
bd139b2317feb5fe3ea3ab4b62664ae70547b2859c372e30cd7062dbaef535a5ea665d33253d85a28553ab13ab0b943f609e86f7fcb9572c403d5b7612052701  mingw-alpine-support.patch
494ec5c871959b9493fbbec7060778d2bb2be689f2434f4b0489b24e9800ea0b3a91015537deae60ffd071ad8740913ee1598f04e1a416516f45658bd9d4315f  fix-missing-includes-path.patch
96b81bb378d0a70b1d31c19c646a95b96056ca3f85c02edc221bc17093b5403ba1fcdf9f3175e455aa32b7399e58a1c9cda525985c09c8b7dee8068bf3643a14  comparison_fn_t.patch
6a5f67177ca74ce051d190a81727b94938addf538c52831b5af3394f4d8d2ea990bcd58e3dc92570c7c4b0719deea49e2aa2fa549297c6e36ec4f8fa3f0a5270  disable-backtrace.patch
56c150d8fcc46720d71a632e7f6ff7a1ad92d90c84361eb8ad81c4b4811ac9ff56f06654f70840895ac7bec4f852bafeff0599e29a4c5572d826403df1d2ca68  001-cmakelist-fortify.patch"
